<?php
/**
 * View Archivio Post LaFabbrica.org
 * 
 * @author     luigi.pastore (gigi@la-fabbrica.org)
 * @created    21-apr-2011
 * @package    LaFabbrica
 * @copyright  Copyright (c) 2011 Luigi Pastore
 */
?>
<script type="text/javascript">
    //<![CDATA[

    $(document).ready(function(){
	var pagination = $('#posts').pagination({
	    'targetUrl' : '/admin/ajax/list/posts',
	    'orderField' : 'post_published',
	    'orderDir' : 'asc'
	});
        
        $( "#searchField" ).keyup( function() {
            if($(this).val().length >= 3)
            {
                var pagination = $('#posts').pagination({
                    'targetUrl' : '/admin/search/posts/'+ $(this).val(),
                    'orderField' : 'post_published',
                    'orderDir' : 'asc',
                    'perPage' : 2
                });
            }
            else if($(this).val().length == 0)
            {
                var pagination = $('#posts').pagination({
                    'targetUrl' : '/admin/ajax/list/posts',
                    'orderField' : 'post_published',
                    'orderDir' : 'asc'
                });                
            }
        });
    });
    //]]>
</script>
<div class="info">
    <h2>Archivio Post</h2>
    <div>Per inserire un nuovo post...</div>
</div>

<form>
    <ul>
	<li class="addnew">
	    <a class="button" href="info">
		<img src="/images/admin/16x16/add-new.png" />Nuovo Post
	    </a>
	</li>
	<li id="fo2li107" class="likert col4">
	    <div>
                <table>
                    <caption id="title107">
                        Tot: <strong><?php echo count($this->posts)?></strong> post.
                        <div class="searchBox">
                            <label class="search">Filter</label>
                            <input class="search" id="searchField" class="text" type="search" value="">
                        </div>
                    </caption>
                    <thead>
                        <tr>
                            <td class="pagination" colspan="5">
                                <a class="prev" href="javascript: void(0);">&nbsp;</a>
                                <span class="loader">Sto caricando...</span>
                                <a class="next" href="javascript: void(0);">&nbsp;</a>
                            </td>
                        </tr>
                        <tr>
                            <th class="sortable default {ref: 'post_title'}">Titolo</th>
                            <td class="sortable default {ref: 'post_category'}">Categoria</td>
                            <td class="sortable default {ref: 'post_createdby'}">Autore</td>
                            <td class="sortable asc {ref: 'post_published'}">Data</td>
                            <td>&nbsp;</td>
                        </tr>
                    </thead>
                    <tbody id="posts">
    <!--		    Questo contenuto verrÃƒÂ  rimpiazzato dalla paginazione-->
                    </tbody>
                    <tfoot>
                        <tr>
                            <td class="pagination" colspan="5">
                                <a class="prev" href="javascript: void(0);">&nbsp;</a>
                                <span class="loader">Sto caricando...</span>
                                <a class="next" href="javascript: void(0);">&nbsp;</a>
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
	</li>
    </ul>
</form>
